package com.gxa.modules.service.impl;

import com.gxa.common.vo.JsonResult;
import com.gxa.modules.mapper.BankWaterMapper;
import com.gxa.modules.pojo.Bank_Water;
import com.gxa.modules.service.BankWaterService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class BankWaterServiceImpl implements BankWaterService {
    @Autowired(required = false)
    private BankWaterMapper bankWaterMapper;
    @Override
    public JsonResult queryBankWater(Integer page, Integer limit) {
        JsonResult jsonResult = new JsonResult();
        Integer param1 = (page - 1)*limit;
        Integer param2 = limit;
        List<Bank_Water> bank_waterList = bankWaterMapper.queryBankWaterZ(param1,param2);
        int result = bankWaterMapper.countBankWaterZ();
        jsonResult.setCount(result);
        jsonResult.setData(bank_waterList);
        jsonResult.setCode(200);
        jsonResult.setMsg("查询成功");
        return jsonResult;
    }

    @Override
    public JsonResult updataBankWater(Bank_Water bank_water) {
        JsonResult jsonResult=new JsonResult();
        bankWaterMapper.updataBankWater(bank_water);
        jsonResult.setCode(200);
        jsonResult.setMsg("编辑成功！");
        return jsonResult;
    }

    @Override
    public JsonResult addBankWater(Bank_Water bank_water) {
        JsonResult jsonResult=new JsonResult();
        bankWaterMapper.addBankWater(bank_water);
        jsonResult.setCode(200);
        jsonResult.setMsg("录入成功！");
        return jsonResult;
    }

    @Override
    public JsonResult delBankWater(Bank_Water bank_water) {
        JsonResult jsonResult=new JsonResult();
        bankWaterMapper.delBankWater(bank_water);
        jsonResult.setCode(200);
        jsonResult.setMsg("删除成功！");
        return jsonResult;
    }
}
